package com.zpark.signup.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;

import java.io.Serializable;
import java.util.Date;

import com.zpark.signup.validate.ValidatedGroup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

/**
 * 报名表
 *
 * @TableName apply_form
 */
@TableName(value = "apply_form")
@Data
@ApiModel(value = "报名对象模型")
public class ApplyForm implements Serializable {
    /**
     * 报名id
     */
    @TableId(type = IdType.AUTO)
    @NotNull(message = "id不能为空", groups = {ValidatedGroup.UPDATE.class})
    @ApiModelProperty("报名id")
    private Integer id;

    /**
     * 组长姓名
     */
    @NotNull(message = "组长姓名不能为空", groups = {ValidatedGroup.CREATE.class})
    @ApiModelProperty("组长姓名")
    private String username;

    /**
     * 组长电话号码
     */
    @NotNull(message = "组长电话不能为空", groups = {ValidatedGroup.CREATE.class})
    @Pattern(regexp = "^1[3-9]\\d{9}$")
    @ApiModelProperty("组长电话号码")
    private String phone;

    /**
     * 组长邮箱
     */

    @Email(groups = {ValidatedGroup.CREATE.class})
    @ApiModelProperty("组长邮箱")
    private String email;

    /**
     * 学校名称
     */
    @NotNull(message = "学校名不能为空", groups = {ValidatedGroup.CREATE.class})
    @ApiModelProperty("学校名称")
    private String school;

    /**
     * 参赛项目
     */
    @NotNull(message = "参赛项目不能为空", groups = {ValidatedGroup.CREATE.class})
    @ApiModelProperty("参赛项目")
    private String competitionId;

    /**
     * 参赛组别
     */
    @NotNull(message = "参赛组别不能为空", groups = {ValidatedGroup.CREATE.class})
    @ApiModelProperty("参赛组别")
    private String competitionGroup;

    /**
     * 组员信息(姓名;年级;专业;班级;联系电话;邮箱)
     */
    @NotNull(message = "组员信息不能为空", groups = {ValidatedGroup.CREATE.class})
    @ApiModelProperty("组员信息(姓名;年级;专业;班级;联系电话;邮箱)")
    private String memberList;

    /**
     * 报名照片
     */
    @NotNull(message = "报名照片不能为空", groups = {ValidatedGroup.CREATE.class})
    @ApiModelProperty("报名照片")
    private String photos;

    /**
     *
     */
    @ApiModelProperty("报名状态")
    private Object status;

    /**
     * 备注
     */
    @ApiModelProperty("备注")
    private String remark;

    /**
     * 创建时间
     */
    @ApiModelProperty("创建时间")
    private Date createdTime;

    /**
     * 更新时间
     */
    @ApiModelProperty("更新时间")
    private Date updatedTime;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        ApplyForm other = (ApplyForm) that;
        return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
                && (this.getUsername() == null ? other.getUsername() == null : this.getUsername().equals(other.getUsername()))
                && (this.getPhone() == null ? other.getPhone() == null : this.getPhone().equals(other.getPhone()))
                && (this.getEmail() == null ? other.getEmail() == null : this.getEmail().equals(other.getEmail()))
                && (this.getSchool() == null ? other.getSchool() == null : this.getSchool().equals(other.getSchool()))
                && (this.getCompetitionId() == null ? other.getCompetitionId() == null : this.getCompetitionId().equals(other.getCompetitionId()))
                && (this.getCompetitionGroup() == null ? other.getCompetitionGroup() == null : this.getCompetitionGroup().equals(other.getCompetitionGroup()))
                && (this.getMemberList() == null ? other.getMemberList() == null : this.getMemberList().equals(other.getMemberList()))
                && (this.getPhotos() == null ? other.getPhotos() == null : this.getPhotos().equals(other.getPhotos()))
                && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
                && (this.getRemark() == null ? other.getRemark() == null : this.getRemark().equals(other.getRemark()))
                && (this.getCreatedTime() == null ? other.getCreatedTime() == null : this.getCreatedTime().equals(other.getCreatedTime()))
                && (this.getUpdatedTime() == null ? other.getUpdatedTime() == null : this.getUpdatedTime().equals(other.getUpdatedTime()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
        result = prime * result + ((getUsername() == null) ? 0 : getUsername().hashCode());
        result = prime * result + ((getPhone() == null) ? 0 : getPhone().hashCode());
        result = prime * result + ((getEmail() == null) ? 0 : getEmail().hashCode());
        result = prime * result + ((getSchool() == null) ? 0 : getSchool().hashCode());
        result = prime * result + ((getCompetitionId() == null) ? 0 : getCompetitionId().hashCode());
        result = prime * result + ((getCompetitionGroup() == null) ? 0 : getCompetitionGroup().hashCode());
        result = prime * result + ((getMemberList() == null) ? 0 : getMemberList().hashCode());
        result = prime * result + ((getPhotos() == null) ? 0 : getPhotos().hashCode());
        result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
        result = prime * result + ((getRemark() == null) ? 0 : getRemark().hashCode());
        result = prime * result + ((getCreatedTime() == null) ? 0 : getCreatedTime().hashCode());
        result = prime * result + ((getUpdatedTime() == null) ? 0 : getUpdatedTime().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", id=").append(id);
        sb.append(", username=").append(username);
        sb.append(", phone=").append(phone);
        sb.append(", email=").append(email);
        sb.append(", school=").append(school);
        sb.append(", competitionId=").append(competitionId);
        sb.append(", competitionGroup=").append(competitionGroup);
        sb.append(", memberList=").append(memberList);
        sb.append(", photos=").append(photos);
        sb.append(", status=").append(status);
        sb.append(", remark=").append(remark);
        sb.append(", createdTime=").append(createdTime);
        sb.append(", updatedTime=").append(updatedTime);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}